<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="boss">
        <div class="delBox">X</div>
        <p></p>
    </div>
    <script>
        const del = document.querySelector('.delBox');
        console.log(del);
        console.log(del.parentNode);
        // 获取父节点parentNode
        //获取子节点 children 返回伪数组获取所有子元素 childNodes返回所有子节点包括文本---
        const son = document.querySelector('.boss').children;
        const sonOw = document.querySelector('.boss').childNodes;
        console.log(son);
        console.log(sonOw);
        //兄弟节点 下一个兄弟nextElementSibling
        //上一个兄弟previousElementSibling
        console.log(document.querySelector('.delBox').nextElementSibling);
        const p = document.querySelector('p').previousElementSibling;
        console.log(p);


        const date = new Date();

        console.log(date.toLocaleString());
        console.log(date.toLocaleTimeString());
        console.log(date.toLocaleDateString());

    </script>
</body>

</html>